{extend name="public:base" /}
{block name="theme"}转介绍管理{/block}
{block name="small_theme"}订单列表{/block}
{block name="breadcrumb"}
<li><a href="{:url('index')}">订单列表</a></li>
<li class="active">订单首页</li>
{/block}
{block name="content"}
<!--<link rel="stylesheet" href="__CSS__/style.css">-->
<link rel="stylesheet" href="__CSS__/indexcommon.css">
<section class="content" style="min-height: 60px;font-size: 14px;">
    <form method="post" action="{:url('index')}" >
        <div class="box_">
            <div class="box_left">
                <div class="form-group leibei">
                    <label>关键词</label>
                    <input type="text" name="keyword" value="{$keyword}" placeholder="手机或者姓名" class="form-control">
                </div>
                <div class="form-group">
                    <label>推荐人</label>
                    <select class="form-control" name="tjr_id">
                        <option value="0" >全部</option>
                        {volist name="user" id="data"}
                        <option value="{$data.id}" {eq name="user_id" value="$data.id"}  selected="selected"{/eq}>{$data.username}</option>
                        {/volist}
                    </select>
                </div>
                <div class="form-group">
                    <label>审核状态</label>
                    <select class="form-control" name="status">
                        <option value="0" >全部</option>
                        {volist name="status" id="data"}
                        <option value="{$data.id}" {eq name="user_id" value="$data.id"}  selected="selected"{/eq}>{$data.name}</option>
                        {/volist}
                    </select>
                </div>
                <div style="margin-left: 20px;">
                    <button class="btn btn-primary">开始查询</button>
                </div>
            </div>
        </div>
    </form>
</section>
<!-- 查询结束 -->
<!-- 列表开始 -->
<div class="row">
    <div class="col-xs-12">
        <div class="box box-list">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <!--<a href="javascript:catorder('{:url('add')}');"  class="btn"><h2 style="margin-top: 0;"><i class="glyphicon glyphicon-plus"></i> 增加员工</h2></a>-->
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="border-bottom: 1px solid #dfdfdf;overflow: hidden;">
                <table class="table table-striped table-bordered table-condensed">
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>顾客姓名</th>
                        <th>手机</th>
                        <!--<th>状态</th>-->
                        <th>推荐人</th>
                        <th>推荐人电话</th>
                        <th>推荐时间</th>
                        <th>审核状态</th>
                        <th>拒绝理由</th>
                        <th style="width: 30px;">订单ID</th>
                        <th>备注</th>
                        <th>审核</th>
                        <th>操作</th>
                    </tr>
                    {volist name='user_list' id="vo" }
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.name}</td>
                        <td>{$vo.tel}</td>
                        <!--<td>{$vo.state}</td>-->
                        <td>{$vo.user.username}</td>
                        <td>{$vo.user.mobile}</td>
                        <td>{$vo.tjtime}</td>
                        <td>{$vo.status_text}</td>
                        <td><span class="tanchu" data-toggle="tooltip" data-placement="right" title="{$vo.jujueliyou}">{$vo.jujueliyou|msubstr=0,4}</span></td>
                        <td><a href="{:url('yewu/olist',['editid'=>$vo['order_id'],'id'=>$vo['order_id'] ])}">{$vo.order_id}</a></td>
                        <td><span class="tanchu" data-toggle="tooltip" data-placement="right" title="{$vo.bz}">{neq name='vo.bz' value='0'}{$vo.bz|msubstr=0,4}{/neq}</span></td>
                        <td>
                            {eq name='vo.status' value='1'}<span style="color: green;">已通过</span>{/eq}
                            {eq name='vo.status' value='2'}
                            <a class="btn btn-nopadding" href="javascript:tongguo('{:url('sh',['id'=>$vo['id'],'act'=>1])}');"><span class="label label-success">通过</span></a>
                            <a class="btn btn-nopadding" href="javascript:jujue('{:url('sh',['id'=>$vo['id'],'act'=>2])}');"><span class="label label-danger">拒绝</span></a>
                            {/eq}
                            {eq name='vo.status' value='3'}<span style="color: red;">已拒绝</span>{/eq}
                        </td>
                        <td>
                            <!-- 编辑订单 -->
                            <a class="btn btn-nopadding" href="javascript:editOrders('{:url('editOrders',['id'=>$vo['id']])}');" alt="修改" title="修改"><i class="glyphicon glyphicon-edit icon-white"></i></a>
                            <!-- 查看订单日志 -->
                            <a class="btn btn-nopadding" href="javascript:catlog('{:url('catlog',['id'=>$vo['id']])}');" alt="查看日志" title="查看日志"><i class="glyphicon glyphicon-list-alt icon-white"></i></a>
                            <!-- 微信推送 -->
                            <a class="btn btn-nopadding" href="javascript:weixin('{:url('pushweixin',['id'=>$vo['id']])}');" alt="微信推送" title="微信推送"><i class="fa fa-weixin"></i></a>
                        </td>
                    </tr>
                    {/volist}

                </table>
            </div>
            <div class="page">{$page}</div>
        </div>
        <!-- /.box -->
    </div>
</div>
<!-- 列表结束 -->
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript" src="__JS__/yewu.js"></script>
<script type="text/javascript">
    function editOrders(name) {
        location.href = name;
    }
    function weixin(name) {
        $.post(name,function(data){
            layer.msg(data.msg, {
                icon: data.code,
                time:3000,
            },function(){
                history.go(0);
            });
        });
    }
    function tongguo(name){
        layer.confirm('您确定审核通过？', {
            btn: ['确定','取消'] //按钮
        }, function(index){
            layer.close(index);
            $.post(name,function(data){
//                console.log(data);
                layer.msg(data.msg, {
                    icon: data.code,
                    time:3000,
                },function(){
                    history.go(0);
                });
            });
        });
    }

    function jujue(name){
        layer.prompt({title: '请填写拒绝理由，并确认', formType: 2}, function(text, index){
            name = name.replace('.html','/jujueliyou/'+text+'.html');
            layer.close(index);
            $.post(name,function(data){
//                console.log(data);
                layer.msg(data.msg, {
                    icon: data.code,
                    time:3000,
                },function(){
                    history.go(0);
                });
            });
        });
    }

    highlight_subnav("{:url('index')}");
</script>
{/block}
